package com.example.dayu521.msg_sender.service.fengin;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.FeignClientFactoryBean;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <a href="https://zhuanlan.zhihu.com/p/369072725">java doc</a><br/>
 * <a href="https://juejin.cn/post/6878481758539481101">这里提到</a>
 * @FeignClient的name和url属性在这块被用到 {@link FeignClientFactoryBean#getTarget}
 *
 * 引入了sentinel后,它对@FeignClient中的配置进行了适配,例如下面就设置了sentinel限流后的回调
 */
@FeignClient(value="${alias.feign.msg-receive}",fallback = Ks2.class,configuration = Ks2.class)
@RestController
public interface MsgReceiveFC {
    @PostMapping("/test/hello")
    String hello();
}

class Ks2 implements MsgReceiveFC{

    @Override
    public String hello() {
        return "MsgReceiveFC 失败 ";
    }
}